import random
import time


def decorator_with_param(tag):
    def run_time(func):
        def wrapper(*args, **kwargs):
            start = time.time()
            result = func(*args, **kwargs)
            end = time.time()
            print("标签: {} 函数: {} 执行时间: {}".format(tag, func.__name__, end - start))
            return result

        return wrapper

    return run_time


@decorator_with_param("Test")
def test():
    print("Hello World")
    time.sleep(random.random())


if __name__ == "__main__":
    test()
